<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue'
export default {
  data () {
    return {
      cdata: {
        category: [
          "总体成绩",
          "1l",
          "2l",
          "3l",
          "1班",
          "2班",
          "3班",
          "4班",
          "5班",
          "6班",
          "7班",
          "8班",
          "9班",
          "10班",
          "11班",
          "12班",
          "13班",
          "14班",
          "15班",
          "16班",
          "17班",
          "18班",
          "19班",
          "20班",
          "21班",
          "22班",
          "23班",
          "24班",
          "25班",
          "26班",
          "27班",
          "28班",
          "29班"
        ],
        lineData: [
          99,
          95,
          98,
          99,
          93,
          95,
          92,
          94,
          91,
          91,
          90,
          92,
          87,
          90,
          95,
          98,
          90,
          95,
          93,
          87,
          90,
          94,
          93,
          91,
          93,
          99,
          97,
          98,
          96,
          97,
          96,
          94,
          90,
          30
        ],
        barData: [
          85,
          84,
          87,
          85,
          90,
          83,
          82,
          81,
          80,
          89,
          87,
          90,
          84,
          84,
          82,
          87,
          88,
          84,
          86,
          81,
          82,
          79,
          80,
          86,
          85,
          89,
          90,
          87,
          88,
          83,
          84,
          86,
          84,
          120
        ],
        rateData: []
      }
    };
  },
  components: {
    Chart,
  },
  mounted () {
    this.setData();
  },
  methods: {
    // 根据自己的业务情况修改
    setData () {
      for (let i = 0; i < this.cdata.barData.length -1; i++) {
        let rate = this.cdata.barData[i] / this.cdata.lineData[i];
        this.cdata.rateData.push(rate.toFixed(2));
      }
    },
  }
};
</script>

<style lang="scss" scoped>
</style>